package com.example.hellomp.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.hellomp.entity.Goods;
import com.example.hellomp.service.GoodsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/goods")
@Tag(name="商品信息管理")
public class GoodsController {
    @Autowired
    private GoodsService goodsService;

    @Operation(summary = "获取所有产品信息")
    @GetMapping("list")
    public List<Goods> getGoods(){
        IPage<Goods> page = new Page<>(1,10);
        List<Goods> list = goodsService.list(page);
        return list;
    }
}
